<% layout('/layouts/default.html', {title: '任务待办', libs: ['layout', 'dataGrid']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-tools pull-left" style="position: relative">
                <ul class="nav nav-tabs bangPing-tabs">
                    <li class="active"><a href="${ctx}/action/dcSupTaskAction/noCompleteView">${text('待办')}</a></li>
                    <li ><a href="${ctx}/action/dcSupTaskAction/completeListView">${text('已办')}</a></li>
                </ul>
            </div>
            <#form:form id="searchForm" model="${dcSupTaskAction}" action="${ctx}/action/dcSupTaskAction/noCompleteListData" method="post" class="form-inline"
            data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
            <div style="float: right">
                <div class="form-group">
                    <label class="control-label">${text('任务年度')}：</label>
                    <div class="control-inline width-120">
                        <#form:select path="dcSupTaskInfo.taskYear" items="${yearList}" blankOption="true" data-placeholder="请选择" itemLabel="yearLabel" itemValue="yearValue" class="form-control width-120" defaultValue="${currentYear}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">${text('任务标题')}：</label>
                    <div class="control-inline width-160">
                        <#form:input path="dcSupTaskInfo.taskTitle" maxlength="200" class="form-control width-160" placeholder="请输入任务标题"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">${text('任务类型')}：</label>
                    <div class="control-inline width-160">
                        <#form:select path="dcSupTaskInfo.taskTypeCode" items="${dicts}" blankOption="true" data-placeholder="请选择" itemLabel="dictLabel" itemValue="dictValue" class="form-control width-160"/>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
                    <button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
                    <button id="changeIcon" type="button" class="btn btn-default btn-sm btnFormMore">${text('高级查询')}<i class="fa fa-angle-double-down" id="changeIcon1"></i></button>
                </div>
                <div class="form-more">
                    <div style="float: right">
                        <div class="form-group">
                            <label class="control-label">${text('任务状态')}：</label>
                            <div class="control-inline width-120">
                                <% var items = [{label:'已接收',value:'2'},{label:'进行中',value:'3'}]; %>
                                <#form:select path="taskStatus" items="${items!}" itemLabel="label" itemValue="value" blankOption="true" data-placeholder="请选择任务状态" class="form-control width-120" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </#form:form>
    </div>
    <div class="box-body">
        <table id="dataGrid"></table>
        <div id="dataGridPage"></div>
    </div>
</div>
</div>
<% } %>
<script>
    //重置
    function cz(){
        searchForm.reset();
        $('#dataGrid').dataGrid('reloadGrid');
    }

    $('#dataGrid').dataGrid({
        dataGridPage: $('#dataGridPage'),
        searchForm: $("#searchForm"),
        sortableColumn: true, // 列表不允许排序
        sortname: 'feedbackEndTimeStr', //设置默认的排序列
        sortorder: 'asc',
    columnModel: [
            {header:'${text("主键")}',hidden: true, name:'id', index:'a.id', width:150, align:"left", frozen:true
                },
            {header:'任务id',hidden: true, name:'dcSupTaskInfo.id', width:150, align:"left"},
            // {header:'${text("任务年度")}', name:'dcSupTaskInfo.taskYear', index:'a.task_year', width:80, align:"center"},
            {header:'${text("督办字号")}',sortable:false, name:'dcSupTaskInfo.messageNumber', index:'a.message_number', width:100, align:"left"},
            {header:'牵头责任单位编号',hidden: true,sortable:false, name:'leaderOrgCode',  width:150, align:"left"},
            {header:'${text("任务标题")}',sortable:false, name:'dcSupTaskInfo.taskTitle', index:'a.task_title', width:150, align:"left"},
            {header:'${text("任务类型")}',sortable:false, name:'dcSupTaskInfo.taskTypeName', index:'a.task_type_name', width:150, align:"left" },
            {header:'任务内容',sortable:false, name:'dcSupTaskInfo.taskContent', width:150, align:"left", formatter: function(val, obj, row, act){
                    return '<a href="${ctx}/taskdeploy/dcSupTaskInfo/detailForm?id='+row.dcSupTaskInfo.id+'" class="btnList" data-title="${text("督办任务信息")}">'+(val||'暂无内容')+'</a>';
                }},
            {header:'牵头责任单位',sortable:false, name:'leaderOrgName',width:150, align:"left",hidden: true},
            {header:'负责科室/人',sortable:false, name:'transferOrgName',  width:100, align:"left"},
            // {header:'最新进展', name:'feedbackContent', width:150, align:"left"},
            // {header:'整体推进状态', name:'infoStatus', width:150, align:"left", formatter: function(val, obj, row, act){return  js.getDictLabel(${@DictUtils.getDictListJson('dc_task_progress')}, val, '${text("无")}', true);}},
            // {header:'逾期未反馈情况', name:'feedbackCount',  width:150, align:"left"},
            {header: "最新待反馈时间",name: 'feedbackEndTimeStr',width: 150,align: 'center', formatter: function(val, obj, row, act){
                    if(val) {
                        if (row.colour=='red')  {
                            return '<span style="color:red">' + val + '</span>'
                        }else {
                            return val
                        }
                    }else {
                        return ''
                    }
                }},
            {header:'任务状态', name:'taskStatus',sortable:false, width:120, align:"center", formatter: function(val, obj, row, act){return  js.getDictLabel(${@DictUtils.getDictListJson('dc_task_action_status')}, val, '${text("未知")}', true);}},
            {header:'${text("操作")}',sortable:false,align:"center", name:'actions1', width:190, formatter: function(val, obj, row, act){
                    var actions = [];
                    actions.push('<a href="${ctx}/audit/taskReceive/taskReceiveFive?isNewRecord=true&id=' + row.id + '&taskId=' + row.dcSupTaskInfo.id + '" class="btn btn-primary btn-xs btnList" title="${text("反馈列表")}"><span>反馈</span></a>&emsp;');
                    actions.push('<a style="cursor:pointer;" onclick=clickFour("'+row.id+'","'+row.decomposeTaskId+'") class="btn btn-primary btn-xs" title="${text("工作安排")}"><span>工作安排</span></a>&emsp;');
                    // if( !(row.decomposeTaskId || row.isDecompose)){
                    // actions.push('<a href="${ctx}/action/dcSupTaskAction/decompose?id=' + row.id + '&taskId=' + row.dcSupTaskInfo.id + '" class="btn btn-primary btn-xs btnList" title="${text("分解")}"><span>分解</span></a>&emsp;');
                    // }
                    return actions.join('');
                }}
        ],
        onSelectRow: function(id, isSelect, event){

        },
        ajaxSuccess: function(data){

        }
    });


    function clickFour(id,taskId){
        js.layer.open({
            type: 2,
            title: ['工作安排'],
            area: ['800px', '200px'],
            scrollbar: true,
            shadeClose: false,
            content: "${ctx}/audit/taskReceive/taskReceiveFour?id="+id+"&decomposeTaskId="+taskId,
            btn1: function (index, layero) {
            },
            end:function () {
                $('#dataGrid').dataGrid('refresh', 1, 20);
            }
        });
    }

</script>